import { createBrowserRouter } from "react-router-dom";

import Login from "../view/Login/Login";
import Home from "../view/Home/Home";
import List from "../view/List/List";
import Xiang from "../view/Xiang/Xiang";
import WuXian from "../view/WuXian/WuXian";
import Language from "../view/Language/Language";
import Table from "../view/Table/Table";
import Bq from "../view/Bq/Bq";

export const MenuRouter = [
  {
    path: "/List",
    meta: {
      title: "列表",
    },
    element: <List />,
  },
  {
    path: "/Xiang/:id",
    meta: {
      title: "详情",
    },
    element: <Xiang />,
  },
  {
    path: "/WuXian",
    meta: {
      title: "无限滚动",
    },
    element: <WuXian />,
  },
  {
    path: "/Language",
    meta: {
      title: "语言",
    },
    element: <Language />,
  },
  {
    path: "/Table",
    meta: {
      title: "表格",
    },
    element: <Table />,
  },
  {
    path: "/Bq",
    meta: {
      title: "标签分类",
    },
    element: <Bq />,
  },
];

const router = createBrowserRouter([
  {
    path: "/",
    element: <Home />,
    children: MenuRouter,
  },
  {
    path: "/Login",
    element: <Login />,
  },
  {
    path: "*",
    element: <h2>404 Not Found</h2>,
  },
]);

export default router;
